﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;
namespace WebSystem
{
    public partial class MUserManDel : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Page_PreInit(object sender, EventArgs e)
        {
            if (Session["Theme"] == "1")
            {
                Page.Theme = "1";
            }
            else if (Session["Theme"] == "3")
            {
                Page.Theme = "3";
            }

            else
            {
                Page.Theme = "2";
            }
        }
        protected void Button4_Click(object sender, EventArgs e)
        {
            string strCn = "server=pc.hstc.cn;database=dhd2014115121;uid=2014115121;pwd=19960404";
            SqlConnection cn = new SqlConnection(strCn);
            try
            {
               
                cn.Open();
             
                string strSql = "DELETE    FROM  UserInfo   WHERE  UserName = N'" + this.txtName.Text + "'";
                SqlCommand cmd = new SqlCommand(strSql, cn);
                int iUpd = cmd.ExecuteNonQuery();
                if (iUpd < 1)
                {
                    this.lblInfo.Text = "删除数据失败！";
                }
                else
                {
                    this.lblInfo.Text = "删除数据成功！";
                }



            }
            catch (Exception ex)
            {
                this.lblInfo.Text = ex.Message;
            }
            finally
            {
                cn.Close();
            }
         

        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((DropDownList1.SelectedItem).ToString() == "注册帐号")
            {
                Response.Redirect("MUserStuRis.aspx");
            }
            if ((DropDownList1.SelectedItem).ToString() == "删除帐号")
            {
                Response.Redirect("MUserStuDel.aspx");
            }


        }

        protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((DropDownList2.SelectedItem).ToString() == "注册帐号")
            {
                Response.Redirect("MUserTeaRis.aspx");
            }
            if ((DropDownList2.SelectedItem).ToString() == "删除帐号")
            {
                Response.Redirect("MUserTeaDel.aspx");
            }
        }

        protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((DropDownList3.SelectedItem).ToString() == "注册帐号")
            {
                Response.Redirect("MUserManRis.aspx");
            }
            if ((DropDownList3.SelectedItem).ToString() == "删除帐号")
            {
                Response.Redirect("MUserManDel.aspx");
            }
        }


        protected void Button5_Click(object sender, EventArgs e)
        {
            Response.Redirect("MUserMod.aspx");
        }

    }
}